<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${cxt }/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>顺风车订单</title>
<link rel="stylesheet" href="${cxt}/css/xw_order.css" />
<link rel="stylesheet" href="${cxt}/css/llp_hitch.css" />
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<script type="text/javascript">
	
	$(document).ready(function() {
		
		//获取系统时间
		var now = new Date();
		//获取年份,月份,日,时，分，秒
		var year = now.getFullYear();
		var month = now.getMonth() + 1;
		var day = now.getDate();
		var hour = now.getHours();
		var fen = now.getMinutes();
		var miao = now.getSeconds();
		//获取限租日期
		var limitday = $("#three_btspan").text();
		//获取取车日期,还车日期
		var value = year+"-"+month+"-"+day;
		var nowday = null;
		
		//判断取车区间与当前时间的大小
		if (CompareDate($("input[name=fromDate]").val(), value)) {
			nowday = $("input[name=fromDate]").val();
			alert(111);
		}else{
			nowday = value;
		}
		//判断用户选择时间与取车时间，当前时间
		var goday = getNewDay(nowday, limitday);
		alert(goday)
		$("input[name=fromDate]").val(nowday);
		$("input[name=toDate]").val(goday);
						
		//获取取车时间的input标签写点击事件
	$(".onehourbox").click(function() {
		$("#fromTime").css("display", "block");
		});
		$(".hc-ul li").click(function() {
		//获取值并且隐藏父类父类
		var value = $(this).text();
		$(".onehourbox").val(value);
		$(this).parent().parent().hide();
			});

		//获取还车时间的input标签写点击事件
	$(".twohourbox").click(function() {
			$(".sz-timex").css("display", "block");
			});
			$(".hc-ul1 li").click(function() {
			//获取值并且隐藏父类父类
			var value = $(this).text();
			$(".twohourbox").val(value);
			$(this).parent().parent().hide();
				});
		//输入身份证号码
		$("input[name=uidcard]").blur(function() {
			var uidcard = $("input[name=uidcard]").val();
			if(isCardNo(uidcard)){
				$("input[name=uidcard]").focus();
			}else{
				$("input[name=uidcard]").blur();
			}
			
		});
		 //输入手机号码
		$("input[name=uemail]").blur(function() {
			var uemail = $("input[name=uemail]").val();
			if(isTelNo(uemail)){
				$("input[name=uemail]").focus();
			}else{
				$("input[name=uemail]").blur();
			}
			
		}); 
			
			
			
 		$(".gopay-red").click(function() {
		//获取取车，还车时间
		var onehour = $(".onehourbox").val();
		var twohour = $(".twohourbox").val();
		var uname = $("input[name=uname]").val();
		var uidcard = $("input[name=uidcard]").val();
		var uemail = $("input[name=uemail]").val();
		var cartype = $().val();
		//订单编号
		var orderid=uname+""+year+""+month+""+day+""+hour+""+fen+""+miao;
		//获取取车时间日期，还车时间日期
		var gettime = nowday+" "+onehour+":00";
		var returntime = goday+" "+twohour+":00";
		var paytime = year+"-"+month+"-"+day+" "+hour+":"+fen+":"+miao;
		location.href = "${cxt}/hitchhiking/hitchpay?uname="+
		uname+"&uidcard="+uidcard+"&uemail="+uemail+"&money=${order.hitch_money }"
		+"&orderid="+orderid+"&paytime="+paytime+"&gettime="+gettime+"&returntime="+returntime;
										});
 	
 	
 	//根据取车时间得到还车时间
	function getNewDay(dateTemp, days) {  
    var dateTemp = dateTemp.split("-");  
    var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]); //转换为MM-DD-YYYY格式    
    var millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000);  
    var rDate = new Date(millSeconds);  
    var year = rDate.getFullYear();  
    var month = rDate.getMonth() + 1;  
    if (month < 10) month = "0" + month;  
    var date = rDate.getDate();  
    if (date < 10) date = "0" + date;  
    return (year + "-" + month + "-" + date);  
	}  
	/*比较日期大小*/
	function CompareDate(d1, d2) {
	return ((new Date(d1.replace(/-/g, "\/")))>(new Date(d2.replace(/-/g, "\/"))));
					}
	
	//身份验证
	function isCardNo(card) 
		{ 
		// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X 
		var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; 
		if(reg.test(card) === false) 
		{ 
			var warning = "您输入的身份证不正确，请重新输入";
			$(".idwarn").html(warning);
			return false; 
		}else{
				$(".idwarn").html("");
		} 
		
  	}
	
	//手机号验证
	function isTelNo(tel) 
		{ 
		// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X 
		var reg = /(^\d{11}$)/; 
		if(reg.test(tel) === false) 
		{ 
			var warning = "您输入的手机号不正确，请重新输入";
			$(".telwarn").html(warning);
			return false; 
		}else{
				$(".telwarn").html("");
		} 
		
  	}
});
</script>
</head>
<body class="f2f3f5">
	<div class="orderDetails" style="width: auto;">
		<div class="order-head">
			<div class="order-con">
				<a href="#" target="_blank" class="order-logo"></a>
				<div class="head-r">
					<div class="order-phonebox">
						<span class="phone-icon"></span>
						<div class="phone-shad">
							<img src="${cxt}/img/xw_zc_gaphone.png" />
						</div>
					</div>
					<ul class="head-info">
						<li><a href="#"> 欢迎您 <i>${utel }</i>
						</a></li>
						<li><a href="#">我的订单</a></li>
						<li class="nobrd"><a href="#">退出</a></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="order-proce">
			<div class="order-con">
				<img src="${cxt}/img/xw_order_proce.png" class="order-proce-i">
				<div class="car-info">
					<div class="ifl">
						<img src="${cxt }/img/${order.carmodelimage}" width="180"
							height="105" />
						<div class="lin">
							<p class="lp1">${order.carmodelname}</p>
							<p class="lp2">${order.carmodelname}/${order.car_type }|
								${order.seating }乘坐人</p>
							<div>
								<p class="bdr_title">
									取车时间：<span id="one_btspan">${order.hitch_time }</span> 到 <span
										id="two_btspan">${order.hitch_return_time }</span>
								</p>
								<p class="bdr_title">
									限租期：<span id="three_btspan">${order.hitch_day }</span> 天
								</p>
							</div>
						</div>
					</div>
					<ul class="ifr one">
						<li class="bdr">
							<p class="le line1">
								<i class="ifr-qc"></i> <span>取车时间</span>
							</p>
							<p class="le line2">
								<i class="ifr-time"></i> <span><input type="date"
									value="${time }" name="fromDate" id="fromDate"
									placeholder="请选择取车日期"> </span>
							</p>
							<p class="le line2">
								<i class="ifr-time"></i> <span> <input type="text"
									value="" class="onehourbox" name="fromHourMinute"
									id="fromHourMinute" placeholder="请选择取车时间" />
								</span>
							<div id="fromTime">
								<ul class="hc-ul">
									<li>08:00</li>
									<li>08:30</li>
									<li>09:00</li>
									<li>09:30</li>
									<li>10:00</li>
									<li>10:30</li>
									<li>11:00</li>
									<li>11:30</li>
									<li>12:00</li>
									<li>12:30</li>
									<li>13:00</li>
									<li>13:30</li>
									<li>14:00</li>
									<li>14:30</li>
									<li>15:00</li>
									<li>15:30</li>
									<li>16:00</li>
									<li>16:30</li>
									<li>15:00</li>
									<li>15:30</li>
									<li>16:00</li>
									<li>16:30</li>
									<li>17:00</li>
									<li>17:30</li>
									<li>18:00</li>
									<li>18:30</li>
									<li>19:00</li>
									<li>19:30</li>
									<li>20:00</li>
									<li>20:30</li>
									<li>21:00</li>
									<li>21:30</li>
								</ul>
							</div>
							</p> <br>
							<p class="le line3 line3top">
								<i class="ifr-local"></i> <span>${order.start_store_city }</span><span>${order.start_store_name }</span>
							</p>
						</li>
						<li>

							<p class="le line1">
								<i class="ifr-hc"></i> <span>还车时间</span>
							</p>
							<p class="le line2">
								<i class="ifr-time"></i> <span><input type="date"
									name="toDate" id="toDate" placeholder="请选择还车日期"> </span>
							</p>

							<p class="le line2">
								<i class="ifr-time"></i> <span><input type="text"
									value="" class="twohourbox" default-value="08:00-12:00"
									name="toHourMinute" id="toHourMinute" placeholder="请选择还车时间" />
								</span>
							<div class="sz-timex" id="toTime">
								<ul class="hc-ul1">
									<li>08:00</li>
									<li>08:30</li>
									<li>09:00</li>
									<li>09:30</li>
									<li>10:00</li>
									<li>10:30</li>
									<li>11:00</li>
									<li>11:30</li>
									<li>12:00</li>
									<li>12:30</li>
									<li>13:00</li>
									<li>13:30</li>
									<li>14:00</li>
									<li>14:30</li>
									<li>15:00</li>
									<li>15:30</li>
									<li>16:00</li>
									<li>16:30</li>
									<li>17:00</li>
									<li>17:30</li>
									<li>18:00</li>
									<li>18:30</li>
									<li>19:00</li>
									<li>19:30</li>
									<li>20:00</li>
									<li>20:30</li>
									<li>21:00</li>
									<li>21:30</li>
								</ul>
							</div> <br>
							<p class="le line3 line3top">
								<i class="ifr-local"></i> <span>${order.end_store_city }</span><span>${order.end_store_name}</span>
							</p>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<form action="mycenter" method="post" id="order">
			<div class="order-conf">
				<div class="order-con">
					<div class="info-msg">
						<p>
							下单成功后，提醒信息会发送至手机 <i></i>
						</p>
					</div>
					<div>
						<h3>
							租车人信息 <span class="ifred">请认真填写一下信息，取车时需要现场核对！</span>
						</h3>
						<ul class="h3h infoul">
							<li><label> <i>*</i> 姓 名
							</label> <input type="text" placeholder="请输入您的姓名" maxlength="50"
								style="border: 1px solid rgb(228, 230, 233); color: rgb(200, 200, 206);"
								value="" name="uname" /></li>
							<li><label> <i>*</i> 证件类型
							</label> <input type="text" value="身份证" readonly="readonly"
								style="color: rgb(47, 47, 57); border: 1px solid rgb(228, 230, 233);" />
							</li>
							<li><label> <i>*</i> 证件号码
							</label> <input type="text" placeholder="请输入证件号码" maxlength="20"
								style="border: 1px solid rgb(228, 230, 233); color: rgb(200, 200, 206);"
								value="" name="uidcard" /> <span class="idwarn"></span> </li>
							<li><label> <i class="none">*</i> 手机号
							</label> <input type="text" placeholder="请输入手机号" maxlength="50"
								style="border: 1px solid rgb(228, 230, 233); color: rgb(200, 200, 206);"
								value="" name="uemail" /> <span class="telwarn"></span>
								<div class="order-youhui"></div></li>
						</ul>
					</div>
					<div class="info-msg">
						<p>下单成功后，提醒信息会发送至手机，预定之后概不退单！</p>
					</div>
					<div class="papers-tip">
						<p>取车时,出示以下证件的原件：本人二代身份证、本人国内有效驾驶证正副本、本人一张信用及可用额度均不低于3000元的国内有效信用卡，所有证件有效期须至少超过当次租期的两个月以上。</p>
					</div>
					<div>
						<h3>费用明细及限程</h3>
						<ul class="h3h feeul">
							<li><span class="fee-txt">顺风车（车辆租赁及门店服务费、基本保险费、手续费）</span> <span
								class="fee-res"> <i>¥</i> ${order.hitch_money }
							</span> <span class="fee-pro"></span>
								<div class="clear"></div></li>
							<li style="position: relative; z-index: 10;"><span
								class="fee-txt"> 燃油费路桥费 </span> <span class="fee-res"> 自理
							</span> <span class="fee-pro"></span>
								<div class="clear"></div></li>
							<li style="position: relative; z-index: 10;"><span
								class="fee-txt"> 限定总里程 </span> <span class="fee-res">
									${order.hitch_miles } <i>Km</i>
							</span> <span class="fee-pro"></span>
								<div class="clear"></div></li>
						</ul>
					</div>
					<div class="gopay">
						<div class="paydetail">
							<span class="ddzj">订单总价</span> <span class="ddall"> <i>¥</i>
								<i class="all">${order.hitch_money }</i>
							</span>
						</div>
						<input type="button" class="gopay-red" value="支付全款" onclick="gopay()">
					</div>
				</div>
			</div>
		</form>
		<div class="order-tggz">
			<div class="order-con">
				<div class="top">顺风车规则</div>
				<dl>
					<dd>1.顺风车产品需在预订时预付全款，预付后不能退改；</dd>
					<dd>2.顺风车产品，取还城市不能更改；</dd>
					<dd>3.限租期内，优惠后总金额含车辆租赁费及门店服务费、基本保险费、手续费；</dd>
					<dd>4.如需可选服务，另外计费；</dd>
					<dd>5.超出限制里程，按1元/公里收取超里程服务费；</dd>
					<dd>6超出限制租期，需支付超时服务费：超时4小时以内，按小时收取超时服务费，每小时赠送20km里程；超时4小时以上，按正常价格按天收取车辆租赁费及门店服务费、基本保险及可选服务等费用，同时赠送不限里程；</dd>
					<dd>7.取车或还车时间在21:00-次日8:00之间，每次需支付50元夜间服务费；</dd>
					<dd>8.顺风车不与其他优惠活动同时享受。</dd>
				</dl>
			</div>
		</div>
	</div>
	<div class="order_footer">
		<p>
			<a href="#">关于我们</a> | <a href="#" target="_blank">投资者关系</a> | <a
				href="#" target="_parent">新闻中心</a> | <a href="#" target="_blank">加盟合作</a>
			| <a href="#" target="_parent">隐私保护</a> | <a href="#"
				target="_parent">网站导航</a> | <a href="#" target="_parent">联系我们</a> |
			<a href="#" target="_blank">招贤纳士</a>
		</p>
		<p>
			<a target="_blank" href="#" class="sz_k"></a> <a target="_blank"
				href="#" class="sz_c"></a>
		</p>
		<p>Copyright©2008-2017 www.zuche.com All Rights Reserved.</p>
		<p>如果您对神州租车网站有任何意见,欢迎发送邮件到 1456073180@qq.com</p>
		<p>北京神州汽车租赁有限公司 京ICP备10005002号 | 京公网安备号 11010502026705</p>
	</div>
</body>
</html>